package com.pdg.dungeondelver.defaulttheme.builders;

import com.pdg.dungeondelver.client.constants.BuilderConstants;
import com.pdg.dungeondelver.client.constants.GameConstants;
import com.pdg.dungeondelver.client.constants.PropertyGroupConstants;
import com.pdg.dungeondelver.engine.Atlas;
import com.pdg.dungeondelver.engine.AtlasCellBuilder;
import com.pdg.dungeondelver.engine.AtlasColumn;
import com.pdg.dungeondelver.engine.AtlasColumnBuilder;

public class DefaultAtlasColumnBuilder implements AtlasColumnBuilder{

	@Override
	public AtlasColumn build(Atlas theAtlas) {
		AtlasColumn column = new AtlasColumn(theAtlas);
		Integer rows = theAtlas.getConfiguration().getPropertyGroups().get(PropertyGroupConstants.GAME_CONSTANTS).<Integer>get(GameConstants.ATLAS_ROWS);
		AtlasCellBuilder builder = theAtlas.getConfiguration().getPropertyGroups().get(PropertyGroupConstants.BUILDERS).<AtlasCellBuilder>get(BuilderConstants.ATLAS_CELL_BUILDER);
		for(Integer row = 0;row<rows;++row){
			column.put(row, builder.build(column));
		}
		return column;
	}

}
